/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 故我
 * Date: 2023-06-12
 * Time: 10:34
 */

import javax.rmi.CORBA.Stub;

/**
 * 局部内部类，可以直接访问外部类的所有成员或者方法
 * 外部类要访问内部类的方法或者成员，必须要通过创建对象才能访问
 */

class Person{
    private int age = 20;
    private String name = "张三";
    public void medo1(){
        System.out.println("Person medo1 方法!");
    }

    public void medo2(){
        final class Student{
            private String name = "李四";
            public void medo3(){
                System.out.println(name);//默认是局部优先
                System.out.println(Person.this.name);
                medo1();
            }
        }
        //外部类访问内部类
        Student student = new Student();
        student.medo3();
    }
}
public class Testdemo1 {
    public static void main(String[] args) {
        Person person = new Person();
        person.medo2();
    }
}
